/*
 * @(#)Interface.java   09/10/12
 * 
 * Copyright (C) 2009 Ecole des Mines d'Ales
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 * Contact: yulinz88@gmail.com
 */



package fr.ema.arch3d.model.architecture;

import org.objectweb.fractal.api.Type;
import org.objectweb.fractal.api.type.InterfaceType;

//~--- classes ----------------------------------------------------------------

/**
 * An interface is a access point of a component or a connector. It contains
 * the
 *
 *
 * @version 1.0, 09/09/16
 * @author Huaxi (Yulin) ZHANG
 */
public class Interface implements InterfaceType {

    /** true if this interface is a client interface */
    private boolean isClientItf;

    /** true if this interface is a collection interface */
    private boolean isCollectionItf;

    /** true if this interface is an option interface */
    private boolean isOptionItf;

    /** a set of method names contained by this interface */
    public String[] methodNames;

    /** the name of this interface */
    private String name;

    /** the signature of this interface */
    private String signature;

    /**
     * Constructs the interface with all required information
     *
     *
     * @param name  the name of this interface
     * @param signature  the signature of this interface
     * @param isClientItf  true if this is a client interface
     * @param isCollectionItf  true if this is a collection interface
     * @param methodNames   the methods contained in this interface
     */
    public Interface(String name, String signature, boolean isClientItf, boolean isCollectionItf,
                     String[] methodNames) {
        this.name            = name;
        this.signature       = signature;
        this.isClientItf     = isClientItf;
        this.isCollectionItf = isCollectionItf;
        this.methodNames     = methodNames;
    }

    /**
     * Get the interface name.
     *
     * @return name
     * @see org.objectweb.fractal.api.type.InterfaceType#getFcItfName()
     */
    public String getFcItfName() {
        return this.name;
    }

    /**
     * Get the signature of this interface.
     *
     * @see org.objectweb.fractal.api.type.InterfaceType#getFcItfSignature()
     * @return signature
     */
    public String getFcItfSignature() {
        return this.signature;
    }

    /**
     * Return true if this interface is a client interface.
     *
     * @return true if this interface is client interface
     * @see org.objectweb.fractal.api.type.InterfaceType#isFcClientItf()
     */
    public boolean isFcClientItf() {
        return this.isClientItf;
    }

    /**
     * Return true if this interface is a collection interface.
     *
     * @return true if this interface is collection interface
     * @see org.objectweb.fractal.api.type.InterfaceType#isFcCollectionItf()
     */
    public boolean isFcCollectionItf() {
        return this.isCollectionItf;
    }

    /**
     * Return true if this interface is an option interface.
     *
     * @return true if this interface is an option interface.
     * @see org.objectweb.fractal.api.type.InterfaceType#isFcOptionalItf()
     */
    public boolean isFcOptionalItf() {
        return this.isOptionItf;
    }

    /**
     * Method description
     *
     * @param arg0
     * @return
     * @see org.objectweb.fractal.api.Type#isFcSubTypeOf(org.objectweb.fractal.api.Type)
     */
    public boolean isFcSubTypeOf(Type arg0) {
        return false;
    }

    /**
     * Getter of the property <tt>methodNames</tt>
     *
     * @return Returns the methodNames.
     *
     */
    public String[] getMethodNames() {
        return this.methodNames;
    }

    /**
     * Setter of the property <tt>methodNames</tt>
     *
     * @param methodNames The methodNames to set.
     *
     */
    public void setMethodNames(String[] methodNames) {
        this.methodNames = methodNames;
    }
}
